﻿Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Data
Imports System.Collections
Imports System.Windows.Forms
Imports DataObject
Imports DataObject.hDBase

Public Class BusDoiTuong

    Private DoiTuongDAO As New SqlServerDoiTuong
    Private oTable As New DataTable

    Public Function GetAllDoiTuong(ByVal sStringConnection As String) As Object
        Try
            oTable = DoiTuongDAO.GetAllDoiTuong(sStringConnection)
        Catch ex As Exception
            MessageBox.Show(ex.ToString, "Thông báo lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
        Return oTable
    End Function

    Public Sub InsertDoiTuong(ByVal sStringConnection As String, ByVal oDoiTuong As DoiTuong)
        Try
            DoiTuongDAO.InsertDoiTuong(sStringConnection, oDoiTuong)
        Catch ex As Exception
            MessageBox.Show(ex.ToString, "Thông báo lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub

    Public Sub UpdateDoiTuong(ByVal sStringConnection As String, ByVal oDoiTuong As DoiTuong)
        Dim bool_ As Boolean = True
        Try
            DoiTuongDAO.UpdateDoiTuong(sStringConnection, oDoiTuong)
        Catch ex As Exception
            MessageBox.Show(ex.ToString, "Thông báo lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub

    Public Sub DeleteDoiTuong(ByVal sStringConnection As String, ByVal oDoiTuong As DoiTuong)
        Try
            DoiTuongDAO.DeleteDoiTuong(sStringConnection, oDoiTuong.SoDoiTuong)
        Catch ex As Exception
            MessageBox.Show(ex.ToString, "Thông báo lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub

End Class
